
#ifndef LOD_LIGHT_H
#define LOD_LIGHT_H

#include "../types.h"

class light
{
   public:
   //! Position of the light in world coordinates
   /*!
    * If w coordinate equals to 0, then the light is directional 
    * (its position affects its direction,
    * but it is not taken into account by diffuse and specular lighting
    * calculations. */
   co_type pos[4];

   //! Ambient RGBA intensity of the light
   comp_type amb[4];
   //! Diffuse RGBA intensity of the  light
   comp_type diff[4];
   //! Specular RGBA intensity of the  light
   comp_type spec[4];


   light()
   {
       init();
       pos[0] = 0;
       pos[1] = 0;
       pos[2] = 1;
       pos[3] = 0;
   }

   light(const co_type* pos)
   {
       init();
       this->pos[0] = pos[0];
       this->pos[1] = pos[1];
       this->pos[2] = pos[2];
       this->pos[3] = pos[3];
   }

   light(const comp_type* a, const comp_type* d, const comp_type* s,
         const co_type* p)
   {
       amb[0] = a[0];
       amb[1] = a[1];
       amb[2] = a[2];
       amb[3] = a[3];

       diff[0] = d[0];
       diff[1] = d[1];
       diff[2] = d[2];
       diff[3] = d[3];

       spec[0] = s[0];
       spec[1] = s[1];
       spec[2] = s[2];
       spec[3] = s[3];

       pos[0] = p[0];
       pos[1] = p[1];
       pos[2] = p[2];
       pos[3] = p[3];
   }


   private:
   void init()
   {
       amb[0] = 0;
       amb[1] = 0;
       amb[2] = 0;
       amb[3] = 1;

       diff[0] = 1;
       diff[1] = 1;
       diff[2] = 1;
       diff[3] = 1;     // the defaults of openGL for LIGHT0

       spec[0] = 1;
       spec[1] = 1;
       spec[2] = 1;
       spec[3] = 1;
   }
};

#endif // LOD_LIGHT_H
